// 引入模块
const fs = require("fs");
const path = require("path");
const http = require("http");

// 配置实例
const server = http.createServer();

// 读取文件
const fullPath = path.join(__dirname, "/data","/info.json");
console.log(fullPath);
const arr = fs.readFileSync(fullPath,"utf8");
console.log(arr);

// 转换为数组
const arr1 = JSON.parse(arr)

// 抽取随机数
  const a = Math.floor(Math.random() *arr1.length)

// 累加
arr1[a].count++;
console.log(arr1[a]);

// 保存
fs.writeFileSync(fullPath,JSON.stringify(arr1))